
#include <stdio.h>
#include "singly-linked-list.h"

int PrintList(SinList List);

SinList MyList;

ElemType Tmp;
int main(){
    InitList(&MyList);
    printf("IsEmpty:%d\n",ListEmpty(MyList));
    ListInsert(&MyList,1,20);
    ListInsert(&MyList,3,30);
    ListInsert(&MyList,5,40);
    ListInsert(&MyList,4,60);
    ListDelete(&MyList,3,&Tmp);
    PrintList(MyList);
    printf("%d has been deleted\n",Tmp);
    printf("IsEmpty:%d\n",ListEmpty(MyList));
    ClearList(&MyList);
    printf("IsEmpty:%d\n",ListEmpty(MyList));
    return(0);

}

int PrintList(SinList List){
    SinLiNode *p_current = List.list_head;
    while (p_current){
        printf("%d ",p_current->node_data);
        p_current = p_current->next_node;
    }
    putchar('\n');
    return(0);
}